﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WinFromMediaPlayerDemo.Model;
using WinFromMediaPlayerDemo.Common;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Concurrent;
using System.Threading;
namespace WinFromMediaPlayerDemo.Forms
{
    public partial class LocalCacheFileForm : ToolFormBase
    {
        public LocalCacheFileForm()
        {
            InitializeComponent();
        }


        private void UpdateRemoteFileForm_Load(object sender, EventArgs e)
        {
            LoadCacheFilesToView();
        }
        /// <summary>
        /// 加载缓存文件到视图
        /// </summary>
        /// <returns></returns>

        public void LoadCacheFilesToView()
        {
            //视频缓存
            var fileInfos = FileHandler.GetLocalCacheFileList();
            foreach (var item in fileInfos)
            {
                int newRow = this.dataGridView1.Rows.Add();
                dataGridView1.Rows[newRow].Cells[0].Value = Path.GetFileName(item);
                dataGridView1.Rows[newRow].Cells[1].Value = Path.GetExtension(item);
                dataGridView1.Rows[newRow].Cells[2].Value = Path.GetFileNameWithoutExtension(item);
                dataGridView1.Rows[newRow].Cells[3].Value = new FileInfo(item).Length;
            }
        }
    }
}

